package com.sailorj.itools.common;

import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.sailorj.itools.utils.GitUtil;
import com.sailorj.itools.utils.Logger;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Repository;

public class GitRunnable implements Runnable {

    Git git;
    Repository repository;
    String projectName;
    Editor mEditor;
    Project project;

    public GitRunnable(Git git, Repository repository, String projectName, Editor mEditor, Project project) {
        this.git = git;
        this.repository = repository;
        this.projectName = projectName;
        this.mEditor = mEditor;
        this.project = project;
    }

    @Override
    public void run() {
        System.out.println(git + "的线程名称：" + Thread.currentThread().getName());
        try {
            GitUtil.gitUtil(project, git, repository, projectName);
        } catch (Exception e) {
            e.printStackTrace();
            Logger.error("执行异常," + e.getMessage());
        }
    }


}
